package com.hui10.mediaplayer.util

import android.content.Intent
import android.support.v7.widget.Toolbar
import com.hui10.mediaplayer.R
import com.hui10.mediaplayer.ui.activity.SettingActivity

/**
 * Author: Created by lucus on 2019/5/23.
 * E-mail: mcphilex1989@gmail.com
 * Tel: 15652608401
 * ToolBar 的管理类
 */
interface ToolBarManager {

    val mToolBar: Toolbar

    fun initMainToolBar() {
        mToolBar.title = "汇影音"
        mToolBar.inflateMenu(R.menu.main)

        mToolBar.setOnMenuItemClickListener {
            mToolBar.context.startActivity(Intent(mToolBar.context, SettingActivity::class.java))
            true
        }

//        mToolBar.setOnMenuItemClickListener(object : Toolbar.OnMenuItemClickListener {
//            override fun onMenuItemClick(menuItem: MenuItem?): Boolean {
//                when (menuItem?.itemId) {
//                    R.id.setting -> {
//                        mToolBar.context.startActivity<SettingActivity>()
//                    }
//                }
//                return true
//            }
//        })
    }

    fun initSettingToolBar() {
        mToolBar.title = "设置"
    }
}